using Community.CsharpSqlite.Entity;
using unsigned = System.UIntPtr;


namespace Community.CsharpSqlite
{
    public partial class Sqlite3
    {
        /*
    ** 2003 September 6
    **
    ** The author disclaims copyright to this source code.  In place of
    ** a legal notice, here is a blessing:
    **
    **    May you do good and not evil.
    **    May you find forgiveness for yourself and forgive others.
    **    May you share freely, never taking more than you give.
    **
    *************************************************************************
    ** This is the header file for information that is private to the
    ** VDBE.  This information used to all be at the top of the single
    ** source code file "vdbe.c".  When that file became too big (over
    ** 6000 lines long) it was split up into several smaller files and
    ** this header information was factored out.
    *************************************************************************
    **  Included in SQLite3 port to C#-SQLite;  2008 Noah B Hart
    **  C#-SQLite is an independent reimplementation of the SQLite software library
    **
    **  SQLITE_SOURCE_ID: 2009-12-07 16:39:13 1ed88e9d01e9eda5cbc622e7614277f29bcc551c
    **
    **  $Header: Community.CsharpSqlite/src/VdbeInt_h.cs,v 6604176a7dbe 2010/03/12 23:35:36 Noah $
    *************************************************************************
    */
        //#if !_VDBEINT_H_
        //#define _VDBEINT_H_

        /*
    ** SQL is translated into a sequence of instructions to be
    ** executed by a virtual machine.  Each instruction is an instance
    ** of the following structure.
    */
        //typedef struct VdbeOp Op;

        /*
    ** Boolean values
    */
        //typedef unsigned char Bool;


        //typedef struct VdbeCursor VdbeCursor;


        //#define VdbeFrameMem(p) ((Mem *)&((byte *)p)[Utility.ROUND8(sizeof(VdbeFrame))])




      

        /*
    ** Clear any existing type flags from a Mem and replace them with f
    */
        //#define MemSetTypeFlag(p, f) \
        //   ((p)->flags = ((p)->flags&~(MEMFlag.MEM_TypeMask|MEMTermFlag.MEM_Zero))|f)
        private static void MemSetTypeFlag(Mem p, int f)
        {
            p.flags = (ushort) (p.flags & ~(MEMFlag.MEM_TypeMask | MEMTermFlag.MEM_Zero) | f);
        }

// TODO -- Convert back to inline for speed

#if  SQLITE_OMIT_INCRBLOB
        //#undef MEMTermFlag.MEM_Zero
#endif


        /*
    ** Function prototypes
    */
        //void VdbeAux.VdbeFreeCursor(Vdbe *, VdbeCursor*);
        //void sqliteVdbePopStack(Vdbe*,int);
        //int VdbeAux.VdbeCursorMoveto(VdbeCursor*);
        //#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
        //void VdbeAux.VdbePrintOp(FILE*, int, Op*);
        //#endif
        //uint VdbeAux.VdbeSerialTypeLen(uint);
        //uint VdbeAux.VdbeSerialType(Mem*, int);
        //u32sqlite3VdbeSerialPut(unsigned char*, int, Mem*, int);
        //uint VdbeAux.VdbeSerialGet(const unsigned char*, uint, Mem*);
        //void VdbeAux.VdbeDeleteAuxData(VdbeFunc*, int);

        //int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
        //int VdbeAux.VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*);
        //int VdbeAux.VdbeIdxRowid(sqlite3 *, long *);
        //int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);
        //int sqlite3VdbeExec(Vdbe*);
        //int VdbeAux.VdbeList(Vdbe*);
        //int VdbeAux.VdbeHalt(Vdbe*);
        //int sqlite3VdbeChangeEncoding(Mem *, int);
        //int sqlite3VdbeMemTooBig(Mem*);
        //int sqlite3VdbeMemCopy(Mem*, const Mem*);
        //void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int);
        //void sqlite3VdbeMemMove(Mem*, Mem*);
        //int sqlite3VdbeMemNulTerminate(Mem*);
        //int sqlite3VdbeMemSetStr(Mem*, const char*, int, byte, void(*)(void*));
        //void sqlite3VdbeMemSetInt64(Mem*, long);
#if SQLITE_OMIT_FLOATING_POINT
    //# define sqlite3VdbeMemSetDouble sqlite3VdbeMemSetInt64
#else
        //void sqlite3VdbeMemSetDouble(Mem*, double);
#endif
        //void sqlite3VdbeMemSetNull(Mem*);
        //void sqlite3VdbeMemSetZeroBlob(Mem*,int);
        //void sqlite3VdbeMemSetRowSet(Mem*);
        //int sqlite3VdbeMemMakeWriteable(Mem*);
        //int sqlite3VdbeMemStringify(Mem*, int);
        //long sqlite3VdbeIntValue(Mem*);
        //int sqlite3VdbeMemIntegerify(Mem*);
        //double sqlite3VdbeRealValue(Mem*);
        //void sqlite3VdbeIntegerAffinity(Mem*);
        //int sqlite3VdbeMemRealify(Mem*);
        //int sqlite3VdbeMemNumerify(Mem*);
        //int sqlite3VdbeMemFromBtree(BtCursor*,int,int,int,Mem*);
        //void sqlite3VdbeMemRelease(Mem p);
        //void sqlite3VdbeMemReleaseExternal(Mem p);
        //int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
        //const char *sqlite3OpcodeName(int);
        //int sqlite3VdbeMemGrow(Mem pMem, int n, int preserve);
        //int VdbeAux.VdbeCloseStatement(Vdbe *, int);
        //void VdbeAux.VdbeFrameDelete(VdbeFrame*);
        //int VdbeAux.VdbeFrameRestore(VdbeFrame *);
        //void sqlite3VdbeMemStoreType(Mem *pMem);  
#if !SQLITE_OMIT_FOREIGN_KEY
        //int VdbeAux.VdbeCheckFk(Vdbe *, int);
#else
    //# define VdbeAux.VdbeCheckFk(p,i) 0
    static int VdbeAux.VdbeCheckFk( Vdbe p, int i ) { return 0; }
#endif

#if !SQLITE_OMIT_SHARED_CACHE
//void sqlite3VdbeMutexArrayEnter(Vdbe *p);
#else
        //# define sqlite3VdbeMutexArrayEnter(p)
        private static void sqlite3VdbeMutexArrayEnter(Vdbe p)
        {
        }
#endif

        //int sqlite3VdbeMemTranslate(Mem*, byte);
        //#if SQLITE_DEBUG
        //  void VdbeAux.VdbePrintSql(Vdbe*);
        //  void sqlite3VdbeMemPrettyPrint(Mem pMem, char *zBuf);
        //#endif
        //int sqlite3VdbeMemHandleBom(Mem pMem);

#if !SQLITE_OMIT_INCRBLOB
//  int sqlite3VdbeMemExpandBlob(Mem *);
#else
        //  #define sqlite3VdbeMemExpandBlob(x) StatusCode.SQLITE_OK
        private static int sqlite3VdbeMemExpandBlob(Mem x)
        {
            return StatusCode.SQLITE_OK;
        }
#endif

        //#endif //* !_VDBEINT_H_) */
    }
}